

import { Picker } from 'antd-mobile/2x'

export const PickerView = (props) => {
    const { value, visible, setVisible, filters } = props

    const data = {
        jiage: [
            [
                { label: '不限', value: '' },
                { label: '<10万', value: [0, 100] },
                { label: '20万-30万', value: [200, 300] },
                { label: '30万-50万', value: [300, 500] },
                { label: '50万-100万', value: [500, 1000] },
                { label: '>1000万', value: [1000, 10000] },
            ],
        ],
        fangxing: [
            [
                { label: '不限', value: '' },
                { label: '1室', value: '一室' },
                { label: '2室', value: '二室' },
                { label: '3室', value: '三室' },
                { label: '3室+', value: '三室+' },
            ],
        ],
        cx: [
            [
                { label: '不限', value: '' },
                { label: '东', value: '东' },
                { label: '西', value: '西' },
                { label: '南', value: '南' },
                { label: '北', value: '北' },
                { label: '南北', value: '南北' },
            ]
        ]
    }

    return (

        <div className='Picker'>
            <Picker
                columns={data[value] && data[value]}
                visible={visible}
                onClose={() => {
                    setVisible(false)
                }}
                value={value}
                onConfirm={v => {
                    filters({ [value]: v[0] })
                }}
            />
        </div>
    )
}

export default PickerView
